import request from '@/utils/request'
// 查询门类树列表
export function listGROUPTree(query) {
  return request({
    url: '/archive/category/getcatemodeltree',
    method: 'get',
    params: query
  })
}


// 新增门类树
export function addGroupTree(data) {
  return request({
    url: '/archive/category',
    method: 'post',
    data: data
  })
}

// 查询门类树详细
export function getGroupTree(ID,query) {

  return request({
    url: '/archive/category/' + ID,
    method: 'get',
    params: query
  })
}

//修改门类树
export function updateGroupTree(data) {
  return request({
    url: '/archive/category',
    method: 'put',
    data: data
  })
}

// 删除门类树
export function delGroupTree(ID) {
  return request({
    url: '/archive/category/' + ID,
    method: 'delete'
  })
}

export function syncGroupTree(){
  return request({
    url: '/archive/category/SyncSubSysTable',
    method: 'get'
  })
}

// 元数据明细列表查询
export function metaData(query) {
  return request({
    url: '/archive/mdataGroup/list',
    method: 'get',
    params: query
  })
}

// 保存元数据方案信息
export function saveMetaData(query) {
  return request({
    url: '/archive/category/bindgroup',
    method: 'post',
    params: query
  })
}
//元数据方案信息
export function getMetaData(groupId) {
  return request({
    url: '/archive/mdataGroup/' + groupId,
    method: 'get'
  })
}

// 查询档号规则
export function getCodeRule(query) {
  return request({
    url: '/archive/coderule/list',
    method: 'get',
    params: query
  })
}

// 新增档号规则
export function addCodeRule(data) {
  return request({
    url: '/archive/coderule',
    method: 'post',
    data: data
  })
}

//修改档号规则
export function updateCodeRule(data) {
  return request({
    url: '/archive/coderule',
    method: 'put',
    data: data
  })
}

// 删除档号规则
export function delCodeRole(ID) {
  return request({
    url: '/archive/coderule/' + ID,
    method: 'delete'
  })
}


//档号规则明细获取档号存储字段
export function getcodecolumnname(query) {
  return request({
    url: '/archive/codelist/getcodecolumnname',
    method: 'get',
    params: query
  })
}
//档号规则明细输入规则字段位数后下拉
export function getselect(query) {
  return request({
    url: '/archive/codelist/getselect',
    method: 'get',
    params: query
  })
}

//档号规则明细获取件档号存储字段
export function getjiancunchuziduan(query) {
  return request({
    url: '/archive/codelist/getjiancunchuziduan',
    method: 'get',
    params: query
  })
}

//档号规则明细获取卷内文件下拉
export function getjianziduanselect(query) {
  return request({
    url: '/archive/codelist/getjianziduanselect',
    method: 'get',
    params: query
  })
}


// // 保存档号规则明细
export function addRoleDetail(data){
  return request({
    url: '/archive/codelist',
    method: 'post',
    data: data
  })
}

 // 获取档号规则明细
export function roleDetailList(type,ID) {
  return request({
    url: '/archive/codelist/getdetail/'+type+'/'+ID,
    method: 'get'
  })
}

//修改档号规则明细
export function updateRoleDetail(data) {
  return request({
    url: '/archive/codelist',
    method: 'put',
    data: data
  })
}

// 应用定义获取当前立档单位所有菜单 /archive/applymodel/listAllMenu
export function listAllMenu(query) {
  return request({
    url: '/archive/applymodel/listAllMenu/'+query.categoryId,
    method: 'get',
    // params: query
  })
}

// 获取应用定义数据
export function getApplyDetail(categoryId, menuId) {
  return request({
    url: '/archive/applymodel/'+menuId+'/'+categoryId,
    method: 'get'
  })
}

// 获取应用定义列表
export function getApply(data){
  return request({
    url: '/archive/applymodel/listmenu?pageNum='+ data.pageNum + '&pageSize=' + data.pageSize,
    method: 'post',
    data: data
  })
}

// 应用定义增加模块
export function addApply(data) {
  return request({
    url: '/archive/applymodel',
    method: 'post',
    data: data
  })
}

// 应用定义删除模块
export function delApply(categoryId, applyId) {
  return request({
    url: '/archive/applymodel/' + categoryId + '/' +applyId,
    method: 'delete'
  })
}

// //应用定义all删除模块
export function delArrApply(data) {
  return request({
    url: '/archive/applymodel/deletebycatemenu/',
    method: 'post',
    data: data
  })
}
//  应用定义复制模块
export function copyApply(data) {
  return request({
    url: '/archive/applymodel/clonefield',
    method: 'post',
    data: data
  })
}

// 应用定义获取明细
export function fieldlist(data) {
  return request({
    url: '/archive/applymodel/fieldlist',
    method: 'post',
    data: data
  })
}

// 应用定义添加明细
export function addApplyDetail(data) {
  return request({
    url: '/archive/applymodel',
    method: 'post',
    data: data
  })
}

  //元数据信息明细查询
  export function cateMdataList(query){
    return request({
      url: '/archive/cateMdataList/list',
      method: 'get',
      params: query
    })
  }

  //元数据信息明细修改
export function updateCateMdataList(data) {
  return request({
    url: '/archive/cateMdataList',
    method: 'put',
    data: data
  })
}

// 元数据信息明细修改 -- 批量
export function updateCateMdataListBatch(data) {
  return request({
    url: '/archive/cateMdataList/batch',
    method: 'put',
    data: data
  })
}


// 展示可以添加到元数据明细的基础数据列表
export function cateMdatalistGroupid(query) {
  return request({
    url: '/archive/cateMdataList/listByGroupId',
    method: 'post',
    params: query
  })
}
// 元数据信息明细添加
export function addCateMdataList(query) {
  return request({
    url: '/archive/cateMdataList',
    method: 'post',
    params: query
  })
}

// 元数据信息明细删除模块
export function delcateMdata(query,ID) {
  return request({
    url: '/archive/cateMdataList/'+ID,
    method: 'delete',
    params: query
  })
}

//档号规则明细修改排序获取左侧列表

export function getorderleft(query){
  return request({
    url: '/archive/codelist/getorderleft',
    method: 'get',
    params: query
  })
}

//档号规则明细修改排序获取右侧列表
export function getorderright(query){
  return request({
    url: '/archive/codelist/getorderright',
    method: 'get',
    params: query
  })
}

//获取当前字段的关联列表
export function getrelevancelist(data){
  return request({
    url: '/archive/cateMdataList/getrelevancelist',
    method: 'POST',
    data: data
  })
}

// 模板管理--获取当前字段的关联列表
export function getrelevancelistTem(data){
  return request({
    url: '/manage/mdataList/getrelevancelist',
    method: 'POST',
    data: data
  })
}

//添加关联
export function addrelevance(data){
  return request({
    url: '/archive/cateMdataList/addrelevance',
    method: 'POST',
    data: data
  })
}

// 模板管理--添加关联
export function addrelevanceTem(data){
  return request({
    url: '/manage/mdataList/addrelevance',
    method: 'POST',
    data: data
  })
}



//获取关联明细
export function getreledetail(ID){
  return request({
    url: '/archive/cateMdataList/getreledetail/'+ID,
    method: 'POST',

  })
}

// 模板管理--获取关联明细
export function getreledetailTem(ID){
  return request({
    url: '/manage/mdataList/getreledetail/'+ID,
    method: 'POST',
  })
}

//获取可选择的关联字段 、针对某个接口单独设置超时时间
export function getrelevancefield(data){
  return request({
    url: '/archive/cateMdataList/getrelevancefield',
    method: 'POST',
    data: data,
    timeout: 3000 // 30秒
  })
}

// 模板管理--获取可选择的关联字段 、针对某个接口单独设置超时时间
export function getrelevancefieldTem(data){
  return request({
    url: '/manage/mdataList/getrelevancefield',
    method: 'POST',
    data: data,
    timeout: 3000 // 30秒
  })
}

//删除关联
export function delterele(data){
  return request({
    url: '/archive/cateMdataList/delterele',
    method: 'POST',
    data: data
  })
}

// 模板管理--删除关联
export function deltereleTem(data){
  return request({
    url: '/manage/mdataList/delterele',
    method: 'POST',
    data: data
  })
}

//修改明细
export function editrele(data){
  return request({
    url: '/archive/cateMdataList/editrele',
    method: 'POST',
    data: data
  })
}

// 模板管理--修改明细
export function editreleTem(data){
  return request({
    url: '/archive/mdataList/editrele',
    method: 'POST',
    data: data
  })
}

//分类方法  获取元数据明细
export function listforshy(data) {
  return request({
    url: '/archive/mdataList/listforshy?pageNum='+data.pageNum+'&pageSize='+data.pageSize,
    method: 'post',
    data: data
  })
}
//把元数据添加到三合一表
export function addmdatatoshy(data) {
  return request({
    url: '/archive/mdataList/addmdatatoshy',
    method: 'post',
    data: data
  })
}
//在三合一中删除元数据
export function deletemdatafromshy(data) {
  return request({
    url: '/archive/mdataList/deletemdatafromshy',
    method: 'post',
    data: data
  })
}
//添加制度
export function addzd(data) {
  return request({
    url: '/archive/gdfwandbgqx/addzd',
    method: 'post',
    data: data
  })
}
//获取制度树
export function gdfwandbgqxTree(id) {
  return request({
    url: '/archive/gdfwandbgqx/gettree/'+id,
    method: 'get',
  })
}
//获取条件列表(制度id)
export function getzd(id) {
  return request({
    url: '/archive/gdfwandbgqx/getzd?id='+id,
    method: 'POST',
  })
}
//制度树修改删除
export function gdfwandbgqxEditzd(data) {
  return request({
    url: '/archive/gdfwandbgqx/editzd',
    method: 'POST',
    data:data
  })
}


//制度树table表格列表
export function gettable(parentId, categoryId) {
  return request({
    url: '/archive/gdfwandbgqx/gettable/'+ parentId + '/' +categoryId,
    method: 'GET',
  })
}

//添加条件
export function addtj(data) {
  return request({
    url: '/archive/gdfwandbgqx/addtj',
    method: 'POST',
    data:data
  })
}
//修改条件
export function edittj(data) {
  return request({
    url: '/archive/gdfwandbgqx/edittj',
    method: 'POST',
    data:data
  })
}
//获取条件列表(制度id)
export function gettjtable(data) {
  return request({
    url: '/archive/gdfwandbgqx/gettjtable?zdId='+data.id+'&type='+data.typedata+'&pageNum='+data.pageNum+'&pageSize='+data.pageSize,
    method: 'GET',
  })
}

//获取条件sql
export function gettjsql(query) {
  return request({
    url: '/archive/gdfwandbgqx/gettjsql',
    method: 'GET',
    params: query
  })
}


//删除条件
export function deletetj(id) {
  return request({
    url: '/archive/gdfwandbgqx/delete/'+id,
    method: 'GET',
  })
}
//历史位置
export function yqdaFilePathHistory(categoryId) {
  return request({
    url: '/archive/yqdaFilePath/history?categoryId='+categoryId,
    method: 'POST',
  })
}
// 查询门类树列表--new
export function getNewtrees(id) {
  return request({
    url: `/archive/trees/getNewtrees/${id}`,
    method: 'get',
  })
}
